package com.pattern;

import org.junit.Test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author: huhx
 * @Date: 2017-11-10 下午 5:26
 */
public class PatternTest {

    @Test
    public void patternTest_1() {
//        Matcher matcher = Pattern.compile("abc" + "=(.*?);").matcher("123=345;abc=344;abcd=4566;"); // abc=344; -- 344
        Matcher matcher = Pattern.compile("abc" + "=(.*);").matcher("123=345;abc=344;abcd=4566;"); // abc=344;abcd=4566; -- 344;abcd=4566
        String result = null;
        if (matcher.find()) {
            result = matcher.group(1);
            System.out.print(matcher.group() + " -- ");
        }
        System.out.println(result);
    }
}
